import Vue from 'vue'
import Vuex from 'vuex'
// import sysUser from './modules/sysUser/index.js'
Vue.use(Vuex)


const store = new Vuex.Store({
	state: {
		hasLogin: false,
		userInfo: {},
		fileList: []
	},
	mutations: {
		login(state, provider) {
			state.hasLogin = true;
			state.userInfo = provider;
			uni.setStorageSync('userInfo', provider);
		},
		login2(state, provider) {
			state.hasLogin = true;
			state.userInfo = provider;
			uni.setStorageSync('userInfo', provider);
		},
		logout(state) {
			state.hasLogin = false;
			state.userInfo = {};
			uni.removeStorageSync('userInfo');
		},
		filePush(state, fileList) {
			if (fileList) {
				state.fileList = fileList;
				uni.setStorageSync('fileList', fileList);
			}
		}
	},
	actions: {},
	modules: {
		// sysUser
	},
	getters: {
		getUserInfo(state) {
			return state.userInfo;
		},
		getFileList(state) {
			return state.fileList;
		}
	}
})

export default store
